package adapter;

import android.content.Context;
import android.support.annotation.Nullable;
import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;

import bean.CourseraBean;
import bean.WorkBean;
import student.andlei.com.student.R;
import utils.GlideUtils;
import utils.StringUtils;

public class CourseraAdapter extends BaseQuickAdapter<CourseraBean,BaseViewHolder> {
    private Context context;
    public CourseraAdapter(Context context, int layoutResId, @Nullable List<CourseraBean> data) {
        super(layoutResId, data);
        this.context =context;
    }

    @Override
    protected void convert(BaseViewHolder helper, CourseraBean item) {
        helper.setText(R.id.tv_schooltitle,""+item.schedule_name);
        helper.setText(R.id.tv_starttime,"开始时间:"+item.start_date);
        helper.setText(R.id.tv_endtime,"结束时间:"+item.end_date);
        GlideUtils.loadImageViewNoteLoding(context,item.schedule_image,(ImageView) helper.getView(R.id.img_coursera));
        //1:校内课程 2:校外课程
        if(item.schedule_type ==1){
            helper.getView(R.id.rlayout_bg).setBackgroundResource(R.color.homepage_titlefont);
            helper.setText(R.id.tv_mode,"校内");
            helper.setText(R.id.tv_class,"班级:"+item.schedule_name);
        }else {
            helper.getView(R.id.rlayout_bg).setBackgroundResource(R.color.bt_yellow_font);
            helper.setText(R.id.tv_mode,"校外");
            helper.setText(R.id.tv_class,"主讲:"+item.real_name);
        }


    }
}
